/*
    This file is part of Darwin.

    Darwin is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Foobar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    
    Darwin uses GALib
    Copyright (c) 1995-1996 Massachusetts Institute of Technology (MIT)
    Copyright (c) 1996-2005 Matthew Wall
    All rights reserved.
    
    Darwin uses ConfigFile
    Copyright (c) 2004 Richard J. Wagner
     
    Darwin, a Genetic Algorithm to solve Timetabling problem
    Copyright (c) 2006 Christian S. Perone
*/  

#include "options.h"

GlobalOptions::GlobalOptions(std::string filename)
{
     mConfigHandler = new ConfigFile(filename);
}

GlobalOptions::~GlobalOptions()
{
     delete mConfigHandler;
}

void GlobalOptions::Parse(void)
{
     mysql_hostname = mConfigHandler->read<std::string>("mysql_hostname");
     mysql_username = mConfigHandler->read<std::string>("mysql_username");
     mysql_password = mConfigHandler->read<std::string>("mysql_password");
     mysql_database = mConfigHandler->read<std::string>("mysql_database");
     
     ga_random_seed = mConfigHandler->read<unsigned int>("ga_random_seed");
     ga_mutation    = mConfigHandler->read<float>("ga_mutation");
     ga_crossover   = mConfigHandler->read<float>("ga_crossover");
     ga_generations = mConfigHandler->read<int>("ga_generations");
     ga_popsize     = mConfigHandler->read<int>("ga_popsize");
     ga_showstats   = mConfigHandler->read<int>("ga_showstats");
     ga_convergence = mConfigHandler->read<int>("ga_convergence");
     
     timetabling_curso = mConfigHandler->read<int>("timetabling_curso");
     timetabling_anosemestre = mConfigHandler->read<std::string>("timetabling_anosemestre");
     timetabling_niveis = mConfigHandler->read<int>("timetabling_niveis");
}

